package com.simplerobot.core;


/**
 * Created by Administrator on 2017/3/8.
 */
public class BaseService{


    /**
     * 获取DAO
     * @param daoClass
     * @return
     */
    public Object getDao(Class daoClass){
       return SysSqlSessionFactory.getSession().getMapper(daoClass);
    }

    /**
     * 提交事物
     */
    public void sessionCommit(){
        try {
            SysSqlSessionFactory.commit();
        } catch (Exception e) {

        }finally {
            SysSqlSessionFactory.closeSession();
        }
    }

    /**
     * 事物回滚
     */
    public void sessionRollback(){
        try {
            SysSqlSessionFactory.rollBack();
        } catch (Exception e) {

        }finally {
            SysSqlSessionFactory.closeSession();
        }
    }


}
